package com.supermap.business.cloud.cust.role;


import com.alibaba.dubbo.config.annotation.Reference;
import com.supermap.dataservice.util.JSONUtil;
import com.supermap.dubbo.api.cloud.cust.role.SysAreaRoleService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author aqua
 * @desc
 * @date 2019年02月28 16:24
 * @email 1301584033@qq.com
 */
@Controller
@RequestMapping("/cloud/cust/role")
public class SysAreaRoleController {

    @Reference(timeout = 100000)
    private SysAreaRoleService sysAreaRoleService;
    //区域树

    @GetMapping("/getTreeArea")
    @ResponseBody
    public JSONUtil getTreeArea(){
        return  sysAreaRoleService.getTreeArea();
    }


    //角色树
    @GetMapping("/getTreeRole")
    @ResponseBody
    public JSONUtil getTreeRole(String areaCode){
        return sysAreaRoleService.getTreeRole(areaCode);
    }


    //分配
    @PutMapping("/putAreaRole")
    @ResponseBody
    public JSONUtil putAreaRole(String areaCode, String roleIds){
        return  sysAreaRoleService.putAreaRole(areaCode,roleIds);
    }


    //区域角色树
    @GetMapping("/getTreeAreaRole")
    @ResponseBody
    public JSONUtil getTreeAreaRole(String areaCode, Integer roleId){
        return sysAreaRoleService.getTreeAreaRole(areaCode,roleId);
    }



    //区域角色菜单树
    @GetMapping("/getTreeAreaRoleMenu")
    @ResponseBody
    public JSONUtil getTreeAreaRoleMenu(String areaCode, Integer roleId){
        return sysAreaRoleService.getTreeAreaRoleMenu(areaCode,roleId);
    }




    //给角色分配区域菜单
    @PutMapping("/putRoleAreaMenu")
    @ResponseBody
    public JSONUtil putRoleAreaMenu(String menuIds, Integer areaRoleId){
        return sysAreaRoleService.putRoleAreaMenu(menuIds,areaRoleId);
    }
}
